package chapter3.section7;

/**
 * 程序3-15：不用递归法求解阶乘
 *
 * @author 作者姓名
 */
public class Recurrence {
    static int fac(int n) {
        int i = 1, mult = 1;
        while (i <= n) {
            mult = mult * i;
            i++;
        }
        return mult;
    }

    public static void main(String[] args) {
        int f = fac(5);
        System.out.println("5!=" + f);
    }
}
